home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Dev / gcc263-src.lha / gcc-2.6.3 / config / m68k / sun3.h < prev    next >
C/C++ Source or Header  |  1993-10-13  |  10KB  |  296 lines

  1. /* Definitions of target machine for GNU compiler.  Sun 68000/68020 version.
  2.    Copyright (C) 1987, 1988, 1993 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  6. GNU CC is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU CC is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU CC; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. /* This comment is here to see if it will keep Sun's cpp from dying.  */
  21.  
  22. /* If you do not need to generate floating point code for the optional
  23.    Sun FPA board, you can safely comment out the SUPPORT_SUN_FPA define
  24.    to gain a little speed and code size.  */
  25.  
  26. #define SUPPORT_SUN_FPA
  27.  
  28. #include "m68k/m68k.h"
  29.  
  30. /* See m68k.h.  7 means 68020 with 68881.  */
  31.  
  32. #ifndef TARGET_DEFAULT
  33. #define TARGET_DEFAULT 7
  34. #endif
  35.  
  36. /* Define __HAVE_FPA__ or __HAVE_68881__ in preprocessor,
  37.    according to the -m flags.
  38.    This will control the use of inline 68881 insns in certain macros.
  39.    Also inform the program which CPU this is for.  */
  40.  
  41. #if TARGET_DEFAULT & 02
  42.  
  43. /* -m68881 is the default */
  44. #define CPP_SPEC \
  45. "%{!msoft-float:%{mfpa:-D__HAVE_FPA__ }%{!mfpa:-D__HAVE_68881__ }}\
  46. %{m68000:-D__mc68010__}%{mc68000:-D__mc68010__}%{!mc68000:%{!m68000:-D__mc68020__}} \
  47. %{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}}"
  48.  
  49. #else
  50.  
  51. /* -msoft-float is the default */
  52. #define CPP_SPEC \
  53. "%{m68881:-D__HAVE_68881__ }%{mfpa:-D__HAVE_FPA__ }\
  54. %{m68000:-D__mc68010__}%{mc68000:-D__mc68010__}%{!mc68000:%{!m68000:-D__mc68020__}} \
  55. %{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}}"
  56.  
  57. #endif
  58.  
  59. /* Prevent error on `-sun3' and `-target sun3' options.  */
  60.  
  61. #define CC1_SPEC "%{sun3:} %{target:}"
  62.  
  63. #define PTRDIFF_TYPE "int"
  64.  
  65. /* We must override m68k.h.  */
  66. #undef WCHAR_TYPE
  67. #undef WCHAR_TYPE_SIZE
  68. #define WCHAR_TYPE "short unsigned int"
  69. #define WCHAR_TYPE_SIZE 16
  70.  
  71. /* These compiler options take an argument.  We ignore -target for now.  */
  72.  
  73. #define WORD_SWITCH_TAKES_ARG(STR)                \
  74.  (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)                \
  75.   || !strcmp (STR, "target") || !strcmp (STR, "assert"))
  76.  
  77. /* -m68000 requires special flags to the assembler.  */
  78.  
  79. #define ASM_SPEC \
  80.  "%{m68000:-mc68010}%{mc68000:-mc68010}%{!mc68000:%{!m68000:-mc68020}} \
  81.   %{fpic:-k} %{fPIC:-k}"
  82.  
  83. /* Names to predefine in the preprocessor for this target machine.  */
  84. /* For a while,  -D_CROSS_TARGET_ARCH=SUN3 was included here,
  85.    but it doesn't work, partly because SUN3 etc. aren't defined
  86.    (and shouldn't be).  It seems that on a native compiler _CROSS_TARGET_ARCH
  87.    should not be defined.  For cross compilers, let's do things as we
  88.    normally do in GCC.  -- rms.  */
  89.  
  90. #define CPP_PREDEFINES "-Dmc68000 -Dsun -Dunix -Asystem(unix)  -Asystem(bsd) -Acpu(m68k) -Amachine(m68k)"
  91.  
  92. /* STARTFILE_SPEC to include sun floating point initialization
  93.    This is necessary (tr: Sun does it) for both the m68881 and the fpa
  94.    routines.
  95.    Note that includes knowledge of the default specs for gcc, ie. no
  96.    args translates to the same effect as -m68881
  97.    I'm not sure what would happen below if people gave contradictory
  98.    arguments (eg. -msoft-float -mfpa) */
  99.  
  100. #if TARGET_DEFAULT & 0100
  101. /* -mfpa is the default */
  102. #define STARTFILE_SPEC                    \
  103.   "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}    \
  104.    %{m68881:Mcrt1.o%s}                    \
  105.    %{msoft-float:Fcrt1.o%s}                \
  106.    %{!m68881:%{!msoft-float:Wcrt1.o%s}}"
  107. #else
  108. #if TARGET_DEFAULT & 2
  109. /* -m68881 is the default */
  110. #define STARTFILE_SPEC                    \
  111.   "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}    \
  112.    %{mfpa:Wcrt1.o%s}                    \
  113.    %{msoft-float:Fcrt1.o%s}                \
  114.    %{!mfpa:%{!msoft-float:Mcrt1.o%s}}"
  115. #else
  116. /* -msoft-float is the default */
  117. #define STARTFILE_SPEC                    \
  118.   "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}    \
  119.    %{m68881:Mcrt1.o%s}                    \
  120.    %{mfpa:Wcrt1.o%s}                    \
  121.    %{!m68881:%{!mfpa:Fcrt1.o%s}}"
  122. #endif
  123. #endif
  124.  
  125. /* Specify library to handle `-a' basic block profiling.
  126.    Control choice of libm.a (if user says -lm)
  127.    based on fp arith default and options.  */
  128.  
  129. #if TARGET_DEFAULT & 0100
  130. /* -mfpa is the default */
  131. #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
  132. %{a:/usr/lib/bb_link.o} %{g:-lg} \
  133. %{msoft-float:-L/usr/lib/fsoft}%{m68881:-L/usr/lib/f68881}\
  134. %{!msoft_float:%{!m68881:-L/usr/lib/ffpa}}"
  135. #else
  136. #if TARGET_DEFAULT & 2
  137. /* -m68881 is the default */
  138. #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
  139. %{a:/usr/lib/bb_link.o} %{g:-lg} \
  140. %{msoft-float:-L/usr/lib/fsoft}%{!msoft-float:%{!mfpa:-L/usr/lib/f68881}}\
  141. %{mfpa:-L/usr/lib/ffpa}"
  142. #else
  143. /* -msoft-float is the default */
  144. #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \
  145. %{a:/usr/lib/bb_link.o} %{g:-lg} \
  146. %{!m68881:%{!mfpa:-L/usr/lib/fsoft}}%{m68881:-L/usr/lib/f68881}\
  147. %{mfpa:-L/usr/lib/ffpa}"
  148. #endif
  149. #endif
  150.  
  151. /* Provide required defaults for linker -e and -d switches.  */
  152.  
  153. #define LINK_SPEC \
  154.  "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}"
  155.  
  156. /* Every structure or union's size must be a multiple of 2 bytes.  */
  157.  
  158. #define STRUCTURE_SIZE_BOUNDARY 16
  159.  
  160. /* This is BSD, so it wants DBX format.  */
  161.  
  162. #define DBX_DEBUGGING_INFO
  163.  
  164. /* Allow folding division by zero.  */
  165. #define REAL_INFINITY
  166.  
  167. /* Generate calls to memcpy, memcmp and memset.  */
  168. #define TARGET_MEM_FUNCTIONS
  169.  
  170. /* This is not a good idea.  It prevents interoperation between
  171.    files compiled with -m68881 and those compiled with -msoft-float.  */
  172. #if 0
  173. #define FUNCTION_VALUEX(MODE)                            \
  174.   gen_rtx (REG, (MODE),                                \
  175.        ((TARGET_68881                            \
  176.          && ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode)) \
  177.         ? 16 : 0))
  178.  
  179. #undef FUNCTION_VALUE
  180. #define FUNCTION_VALUE(VALTYPE,FUNC) FUNCTION_VALUEX (TYPE_MODE (VALTYPE))
  181. #endif /* 0 */
  182.  
  183. /* This is how to output an assembler line defining a `double' constant.  */
  184.  
  185. #undef ASM_OUTPUT_DOUBLE
  186. #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                \
  187.   {                                \
  188.     if (REAL_VALUE_ISINF (VALUE))                \
  189.       {                                \
  190.         if (REAL_VALUE_NEGATIVE (VALUE))            \
  191.           fprintf (FILE, "\t.double 0r-99e999\n");        \
  192.         else                            \
  193.           fprintf (FILE, "\t.double 0r99e999\n");        \
  194.       }                                \
  195.     else if (REAL_VALUE_ISNAN (VALUE))                \
  196.       { long l[2];                        \
  197.         REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), l);        \
  198.     fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n", l[0], l[1]); \
  199.       }                                \
  200.     else                            \
  201.       { char dstr[30];                        \
  202.         REAL_VALUE_TO_DECIMAL ((VALUE), "%.17g", dstr);        \
  203.         fprintf (FILE, "\t.double 0r%s\n", dstr);        \
  204.       }                                \
  205.     }
  206.  
  207. /* This is how to output an assembler line defining a `float' constant.  */
  208.  
  209. #undef ASM_OUTPUT_FLOAT
  210. #define ASM_OUTPUT_FLOAT(FILE,VALUE)                \
  211.   {                                \
  212.     if (REAL_VALUE_ISINF (VALUE))                \
  213.       {                                \
  214.         if (REAL_VALUE_NEGATIVE (VALUE))            \
  215.           fprintf (FILE, "\t.single 0r-99e999\n");        \
  216.         else                            \
  217.           fprintf (FILE, "\t.single 0r99e999\n");            \
  218.       }                                \
  219.     else if (REAL_VALUE_ISNAN (VALUE))                \
  220.       { long l;                            \
  221.         REAL_VALUE_TO_TARGET_SINGLE ((VALUE), l);        \
  222.         fprintf (FILE, "\t.long 0x%lx\n", l);            \
  223.       }                                \
  224.     else                            \
  225.       { char dstr[30];                        \
  226.         REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr);        \
  227.         fprintf (FILE, "\t.single 0r%s\n", dstr);        \
  228.       }                                \
  229.     }
  230.  
  231. /* This is how to output an assembler lines defining floating operands.
  232.    There's no way to output a NaN's fraction, so we lose it.  */
  233.   
  234. #undef ASM_OUTPUT_FLOAT_OPERAND
  235. #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE)        \
  236.  do {                                 \
  237.       if (CODE != 'f')                        \
  238.         {                            \
  239.           long l;                        \
  240.           REAL_VALUE_TO_TARGET_SINGLE (VALUE, l);        \
  241.           if (sizeof (int) == sizeof (long))            \
  242.             asm_fprintf ((FILE), "%I0x%x", l);            \
  243.           else                            \
  244.             asm_fprintf ((FILE), "%I0x%lx", l);            \
  245.         }                            \
  246.       else if (REAL_VALUE_ISINF (VALUE))            \
  247.         {                            \
  248.           if (REAL_VALUE_NEGATIVE (VALUE))            \
  249.             asm_fprintf (FILE, "%I0r-99e999");            \
  250.           else                            \
  251.             asm_fprintf (FILE, "%I0r99e999");            \
  252.         }                            \
  253.       else if (REAL_VALUE_MINUS_ZERO (VALUE))            \
  254.         {                            \
  255.           asm_fprintf (FILE, "%I0r-0.0");            \
  256.         }                            \
  257.       else                            \
  258.         { char dstr[30];                    \
  259.           REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr);    \
  260.           asm_fprintf (FILE, "%I0r%s", dstr);            \
  261.         }                            \
  262.     } while (0)
  263.  
  264. #undef ASM_OUTPUT_DOUBLE_OPERAND
  265. #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)                \
  266.  do { if (REAL_VALUE_ISINF (VALUE))                    \
  267.         {                                \
  268.           if (REAL_VALUE_NEGATIVE (VALUE))                \
  269.             asm_fprintf (FILE, "%I0r-99e999");                \
  270.           else                                \
  271.             asm_fprintf (FILE, "%I0r99e999");                \
  272.         }                                \
  273.       else if (REAL_VALUE_MINUS_ZERO (VALUE))                \
  274.         {                                \
  275.           asm_fprintf (FILE, "%I0r-0.0");                \
  276.         }                                \
  277.       else                                \
  278.         { char dstr[30];                        \
  279.           REAL_VALUE_TO_DECIMAL ((VALUE), "%.17g", dstr);        \
  280.           asm_fprintf (FILE, "%I0r%s", dstr);                \
  281.         }                                \
  282.     } while (0)
  283.  
  284. #undef BLOCK_PROFILER_CODE
  285. #define BLOCK_PROFILER_CODE                        \
  286. extern int ___tcov_init;                        \
  287.                                     \
  288. __bb_init_func (blocks)                            \
  289.     struct bb *blocks;                        \
  290. {                                    \
  291.   if (! ___tcov_init)                            \
  292.     ___tcov_init_func ();                        \
  293.                                     \
  294.   ___bb_link (blocks->filename, blocks->counts, blocks->ncounts);    \
  295. }
  296.